import http from "@/utils/request";
/**
 * 获取用户分页列表
 *
 * @param queryParams
 */
export const getNewsPage = (queryParams: any) => {
  return http({
    url: "/api/v1/news/page",
    method: "get",
    params: queryParams,
    headers: {
      'Content-Type': 'application/json'
    }
  });
}

/**
 * 获取表单详情
 *
 * @param id
 */
export const getNewsForm = (id: number) =>{
  return http({
    url: "/api/v1/news/getNewsForm",
    method: "get",
    params: {id: id},
    headers: {
      'Content-Type': 'application/json'
    }
  });
}

/**
 * 添加
 *
 * @param data
 */
export const addNews = (data: CourseCategory) => {
  return http({
    url: "/api/v1/news/add",
    method: "post",
    data: data,
    headers: {
      'Content-Type': 'application/json'
    }
  });
}

/**
 * 修改信息
 *
 * @param data
 */
export const updateNews = (data: CourseCategoryForm) => {
  return http({
    url: "/api/v1/news/update",
    method: "put",
    data: data,
    headers: {
      'Content-Type': 'application/json'
    }
  });
}

/**
 * 删除信息
 * @param id
 */
export const deleteNews = (id: number) => {
  return http({
    url: "/api/v1/news/delete",
    method: "delete",
    data: id,
    headers: {
      'Content-Type': 'application/json'
    }
  });
}
